const DataUtil = {
  getObjectValue (object, path, defaultValue) {
    defaultValue = (typeof defaultValue === 'undefined') ? null : defaultValue

    var obj = object
    if (path.trim() !== '') {
      var keys = path.split('.')
      keys.forEach((key) => {
        if (obj !== null && typeof obj[key] !== 'undefined' && obj[key] !== null) {
          obj = obj[key]
        } else {
          obj = defaultValue
          return
        }
      })
    }
    return obj
  }
}

export default DataUtil
